package org.dream.ui.listener;

import java.awt.event.KeyEvent;

import org.dream.ui.MainFrame;
import org.dream.ui.StockTablePanel;
import org.dream.ui.chart.impl.KChart;

public class KChartKeyListener extends MainKeyListener {
	private KChart kChart;

	public KChartKeyListener(KChart kChart) {
		this.kChart = kChart;
	}

	@Override
	public void keyPressed(KeyEvent e) {
		super.keyPressed(e);
		switch (e.getKeyCode()) {
			case KeyEvent.VK_UP:
				kChart.zoom(0.75);
				break;
			case KeyEvent.VK_DOWN:
				kChart.zoom(1.25);
				break;
			case KeyEvent.VK_LEFT:
				kChart.move(-0.2);
				break;
			case KeyEvent.VK_RIGHT:
				kChart.move(0.2);
				break;
			case KeyEvent.VK_ESCAPE:
				MainFrame.getInstanse().setCenterPanel(StockTablePanel.getJTabbedPane());
				break;
			default:
				break;
		}
	}

}
